# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-clevercsv
pkgver=0.8.0
_commit=25d696a0adb94e875bad7887ad34ac4be4bd6d3f
pkgrel=1
pkgdesc="A Python package for handling messy CSV files"
url="https://github.com/alan-turing-institute/CleverCSV"
license=('MIT')
arch=('loong64' 'x86_64')
depends=('python-chardet' 'python-regex' 'python-packaging')
makedepends=('git' 'python-setuptools')
optdepends=('python-pandas' 'python-tabview' 'python-wilderness' 'python-cchardet')
checkdepends=('python-pytest-runner' 'python-pandas' 'python-tabview' 'python-wilderness'
              'python-faust-cchardet' 'python-termcolor')
source=("git+https://github.com/alan-turing-institute/CleverCSV.git#commit=$_commit")
sha512sums=('SKIP')

build() {
  cd CleverCSV
  python setup.py build
}

check() {
  cd CleverCSV
  PYTHONPATH="$PWD"/build/lib.linux-$CARCH-3.10 python setup.py pytest
}

package() {
  cd CleverCSV
  python setup.py install --root="$pkgdir" --optimize=1
  mkdir "$pkgdir"/usr/share
  mv "$pkgdir"/usr/man "$pkgdir"/usr/share/man 

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
